﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace QInfrastructure.WebCore.Filters;

public class QPermissionAttribute : ActionFilterAttribute
{
    public long PermissionKey { get; set; }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="permissionKey">QPermissionKey的异或值</param>
    public QPermissionAttribute(int permissionKey)
    {
        PermissionKey = permissionKey;
    }
	public QPermissionAttribute(long permissionKey)
	{
		PermissionKey = permissionKey;
	}
	public override void OnActionExecuted(ActionExecutedContext context)
    {

    }

    public override void OnActionExecuting(ActionExecutingContext context)
    {
        var areaName = context.ActionDescriptor.RouteValues["area"] == null ? "" : context.ActionDescriptor.RouteValues["area"].ToString();
        var controllerName = context.ActionDescriptor.RouteValues["controller"] == null ? "" : context.ActionDescriptor.RouteValues["controller"].ToString();
        var actionName = context.ActionDescriptor.RouteValues["action"] == null ? "" : context.ActionDescriptor.RouteValues["action"].ToString();



    }
}
